import java.util.Iterator;
import java.util.Spliterator;
import java.util.function.Consumer;

/**
 * Created by asus on 2017/10/31.
 */
public class SLArrayBinaryTree<T> implements BinaryTree<T> {
    protected int position = 0;
    protected int size = 0;
    protected int DEFAULT_CAPACITY= 7;
    protected SLNode<T>[] myTree ;
    protected SLNode<T> item;

    public SLArrayBinaryTree(T element,int left,int right){
        myTree = new SLNode[DEFAULT_CAPACITY];
        if (left>myTree.length||right>myTree.length){
            expendCapacity();
        }
        item = new SLNode<T>(element,left,right);
        add(this);
    }
    public void expendCapacity(){
        SLNode[] newtree = new SLNode[DEFAULT_CAPACITY*2];
        for (int i=0;i<myTree.length;i++){
            newtree[i] = myTree[i];
        }
        myTree = newtree;
    }

    public void add(SLArrayBinaryTree<T> mySLArray){
            myTree[position]=mySLArray.item;
            position++;
            size++;
    }
    public void add(T element,int left,int right){
        SLNode<T> index = new SLNode<T>(element,left,right);
        myTree[position] = index;
        position++;
        size++;
    }
    @Override
    public void forEach(Consumer<? super T> action) {

    }

    @Override
    public Spliterator<T> spliterator() {
        return null;
    }

    @Override
    public T getRootElement() {
        return null;
    }

    @Override
    public BinaryTree<T> getLeft() {
        return null;
    }

    @Override
    public BinaryTree<T> getRight() {
        return null;
    }

    @Override
    public boolean contains(T target) {
        return false;
    }

    @Override
    public T find(T target) {
        return null;
    }

    @Override
    public boolean isEmpty() {
        return false;
    }

    @Override
    public int size() {
        return 0;
    }

    @Override
    public Iterator<T> preorder() {


        return null;
    }

    @Override
    public Iterator<T> inorder() {
        ArrayIterator<T> iter = new ArrayIterator<>();


        return null;
    }

    @Override
    public Iterator<T> postorder() {
        return null;
    }

    @Override
    public Iterator<T> levelorder() {
        return null;
    }

    @Override
    public Iterator<T> iterator() {
        return null;
    }
}
